﻿using System;
using System.Collections.Generic;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace SmlEngine
{
    public enum ScreenBoxMode
    {
        None,
        /// <summary>
        /// Display is square while window is wide, results in horizontal black bars on either side of the display.
        /// </summary>
        Pillarboxed,
        /// <summary>
        /// Display is wide while window is square, results in vertical black bars on either side of the display.
        /// </summary>
        Letterboxed
    }

    /// <summary>
    /// A manager for the SpriteBatch class.
    /// </summary>
    public class SpriteBatchManager : GameComponent
    {
        #region Properties
        /// <summary>
        /// The managed SpriteBatch.
        /// </summary>
        public SpriteBatch SpriteBatch { get; set; }
        
        /// <summary>
        /// The GraphicsDevice of the managed SpriteBatch.
        /// </summary>
        public GraphicsDevice GraphicsDevice
        {
            get { return SpriteBatch.GraphicsDevice; }
        }

        #region Resizing

        /// <summary>
        /// The preferred size of this SpriteBatch.
        /// </summary>
        public Point PreferredSize { get; set; }
        /// <summary>
        /// The current size of the managed SpriteBatch.
        /// </summary>
        public Point CurrentSize
        {
            get { return Game.Window.ClientBounds.Location; }
        }

        /// <summary>
        /// A viewport.
        /// </summary>
        public Viewport Box
        {
            get;
            set;
        }

        #endregion

        #endregion

        #region Methods

        /// <summary>
        /// Constructs a new SpriteBatchManager.
        /// </summary>
        /// <param name="game">The current game.</param>
        /// <param name="spriteBatch">The SpriteBatch to use.</param>
        public SpriteBatchManager(Game game, SpriteBatch spriteBatch)
            : base(game)
        {
            SpriteBatch = spriteBatch;

            PreferredSize = CurrentSize;
        }

        /// <summary>
        /// Constructs a new SpriteBatchMananger.
        /// </summary>
        /// <param name="game">The current game.</param>
        /// <param name="spriteBatch">The SpriteBatch to use.</param>
        /// <param name="preferredSize">The preferred size of this SpriteBatch.</param>
        public SpriteBatchManager(Game game, SpriteBatch spriteBatch, Point preferredSize)
            : base(game)
        {
        }

        #endregion
    }
}
